home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / batchut / vbell.zip / VBELL.PAS < prev   
Pascal/Delphi Source File  |  1988-03-13  |  2KB  |  50 lines

  1.  
  2. {    VBELL.PAS  03-13-88  TEM  Variable Sound Utility for .bat }
  3. {    =-=-=-=-=  Hz 925 and Sustain 200 are equivalent of BEEP. }
  4. {               Turbo Pascal Version 4.0 (uses CRT unit).      }
  5.  
  6. program vbell;
  7. uses Crt;
  8. var
  9.   error    : integer;     { In case Val function returns error }
  10.   Hz       : word;
  11.   Sus      : word;
  12.  
  13. begin
  14.   hz := 00925;        { Hertz cycles per second pitch of sound }
  15.   Sus:= 00200;        { Sustain period in 1000ths of a second. }
  16.  
  17.   If ParamCount < 2 then
  18.      begin
  19.      Writeln(' ');
  20.      Writeln(' VBELL format:   vbell  hertz  sustain   comment/ignored.');
  21.      Writeln(' --------------------------------------------------------');
  22.      Writeln(' Where hertz   is  50 to 12000  cycles per second  pitch.');
  23.      Writeln('       sustain is 100 to 30000  for 1000ths  of a second.');
  24.      Writeln(' ');
  25.      Writeln(' EXAMPLES:  vbell   50  200     the sound you just heard.');
  26.      Writeln('            vbell  925  200     equivalent of DOS beep.  ');
  27.      Writeln('            vbell  100  100     soft and subtle.         ');
  28.      Sound(50);
  29.      Delay(200);
  30.      NoSound;
  31.      exit
  32.   end;
  33.  
  34.   If ParamCount > 1 then                    { So 2 parms were entered   }
  35.      begin
  36.      Val(ParamStr(1), Hz, error);           { Convert string to integer }
  37.        If error >   0 then Hz  :=   925;    { Default if error   }
  38.        If Hz  <    50 then Hz  :=    50;    { Range checking }
  39.        If Hz  > 12000 then Hz  := 12000;
  40.      Val(ParamStr(2), Sus, error);
  41.        If error >   0 then Sus :=   200;    { Default if error   }
  42.        If Sus <   100 then Sus :=   100;
  43.        If Sus > 30000 then Sus := 30000;    { 30 seconds maximum }
  44.      Sound(Hz);                             { Cycles per second pitch. }
  45.      Delay(Sus);                            { Mileseconds to sustain sound }
  46.      NoSound;                               { Required to stop sound ! }
  47.      exit
  48.   end;
  49. end.
  50.